package com.kehutong.wwin.event.entity;

import org.coraframework.orm.Entity;
import org.coraframework.orm.annotation.Column;
import org.coraframework.orm.annotation.Table;

import com.kehutong.wwin.event.util.EventStatus;

@Table(value = "t_wwin_event", comment="指令事件")
public class Event extends Entity {

	private static final long serialVersionUID = -2154445731714343538L;

	protected Event(String id) {
		super(id);
	}
	
	@Column(comment = "企业id")
	private String cropid;
	
	@Column(comment = "客户通企业id")
	private String khtid;
	
	@Column(comment = "消息类型")
	private String msgType;

	@Column(comment = "事件类型")
	private String event;

	@Column(comment = "改变类型")
	private String changeType;
	
	@Column(comment = "随机串，对应URL参数的nonce")
	private String nonce;

	@Column(length=128, comment = "签名串，对应URL参数的msg_signature")
	private String msg_signature;
	
	@Column(comment = "时间戳")
	private String timestamp;

	@Column(dbType="TEXT", comment = "通知内容")
	private String content;

	@Column(comment = "处理结果")
	private EventStatus status;
	
	@Column(dbType="TEXT", comment = "处理异常")
	private String exceptions;

	public String getCropid() {
		return cropid;
	}

	public void setCropid(String cropid) {
		this.cropid = cropid;
	}
	
	public String getKhtid() {
		return khtid;
	}

	public void setKhtid(String khtid) {
		this.khtid = khtid;
	}

	public String getMsgType() {
		return msgType;
	}

	public void setMsgType(String msgType) {
		this.msgType = msgType;
	}

	public String getEvent() {
		return event;
	}

	public void setEvent(String event) {
		this.event = event;
	}

	public String getChangeType() {
		return changeType;
	}

	public void setChangeType(String changeType) {
		this.changeType = changeType;
	}

	public String getNonce() {
		return nonce;
	}

	public void setNonce(String nonce) {
		this.nonce = nonce;
	}

	public String getMsg_signature() {
		return msg_signature;
	}

	public void setMsg_signature(String msg_signature) {
		this.msg_signature = msg_signature;
	}

	public String getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(String timestamp) {
		this.timestamp = timestamp;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public EventStatus getStatus() {
		return status;
	}

	public void setStatus(EventStatus status) {
		this.status = status;
	}

	public String getExceptions() {
		return exceptions;
	}

	public void setExceptions(String exceptions) {
		this.exceptions = exceptions;
	}
	
	
	public String getNoticeUrl() {
		return new StringBuilder("/").append(msgType)
					.append("/").append(event)
					.append("/").append(changeType)
					.toString();
	}
}
